Subject: Re: Help with datestamps
From: "Joseph E. Van_Riper III" <[email-masked]>
To: [email-masked]
Date: Thu, 22 Jul 1993 09:04:21 -0400 (EDT)

I think he typed something like:

----8<----8<----

MODULE 'dos/dos', 'dos/datetime'

PROC main()

DEF date : PTR TO datetime,

    s[10] : ARRAY OF CHAR

    date := New(SIZEOF datetime)
    date.stamp := New(SIZEOF datestamp)
    date.stamp := DateStamp(date.stamp) /*If doing it this way, try*/
    date.strdate := s                  /* just 'DateStamp(date.stamp)'*/
    DateToStr(date)                    /* without the assignment.*/
    WriteF('date: \s\n',s)

ENDPROC

----8<----8<----
I tried something like this, too, and found it didn't work.

I think the reason why is E doesn't know that date.stamp is supposed to be of
object datestamp, so when you try to date.stamp:=DateStamp(date.stamp), it
fails.  The following code has worked very well for me:

PROC whatever()
 DEF dt:datetime 
  DateStamp(dt.stamp)
  dt.format:=FORMAT_DOS /* set datetime options */
  dt.flags:=0
  dt.strday:=String(10)
  dt.strdate:=String(10)
  dt.strtime:=String(10)
  DateToStr(dt)         /* make into string */

/*whatever*/

ENDPROC

You can Dispose() of dt.strday/dt.strdate/dt.strtime if you want to keep from
losing room (say, in a program that will be calling on this routine fairly
regularly for a good while).  For the program I'm working on, however, this was
adequate.

Hope it's helpful.

- Trey